﻿using System;
using System.Collections.Generic;
using Color = System.Drawing.Color;
using SwinGame;
using System.Diagnostics;

namespace Jumpman.src
{
    public class GoToLevel:IAction
    {
        public void DoAction(GameController gc)
        {
           
            gc.MainLoader.SetBackgroundImage(Resources.LoadBitmap("levelbg.png"));
            Music.Stop();
            gc.MainLoader.SetBackGroundMusic(Audio.LoadMusic("level1.mp3"));
            //gc.MainLoader.SetStageMap(Resources.LoadMap("level1"));
            gc.MainLoader.ClearAll();

            gc.Player = new Mario();

            #region block creation
            for (int h = 12; h >= 10; h--)
            {

                for (int i = 0; i <= 20; i++)
                {
                    gc.MainLoader.AddBlocks(new Blocks(i, h));
                }
            }

            for (int h = 12; h >= 10; h--)
            {

                for (int i = 22; i <= 200; i++)
                {
                    gc.MainLoader.AddBlocks(new Blocks(i, h));
                }
            }

            for (int h = 7; h >= 7; h--)
            {

                for (int i = 22; i <= 25; i++)
                {
                    gc.MainLoader.AddBlocks(new Blocks(i, h));
                }
            }

            for (int h = 9; h >= 9; h--)
            {

                for (int i = 5; i <= 8; i++)
                {
                    gc.MainLoader.AddBlocks(new Blocks(i, h));
                }
            }
            #endregion

            gc.MainLoader.AddDrawable(gc.Player);
            gc.MainLoader.AddUpdatable(gc.Player);
            gc.MainLoader.AddElement(gc.Player);
            gc.MainLoader.CreateStage(gc);
            

        }
    }
}
